home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC]
/
NeXTSTEP 3.3 Dev Intel.iso
/
NextDeveloper
/
Source
/
GNU
/
emacs
/
lisp
/
modula2.elc
< prev
next >
Wrap
Text File
|
1991-01-09
|
10KB
|
151 lines
(defvar m2-mode-syntax-table nil "\
Syntax table in use in Modula-2-mode buffers.")
(defvar m2-compile-command "m2c" "\
Command to compile Modula-2 programs")
(defvar m2-link-command "m2l" "\
Command to link Modula-2 programs")
(defvar m2-link-name nil "\
Name of the executable.")
(if m2-mode-syntax-table nil (let ((table (make-syntax-table))) (modify-syntax-entry 92 "\\" table) (modify-syntax-entry 40 ". 1" table) (modify-syntax-entry 41 ". 4" table) (modify-syntax-entry 42 ". 23" table) (modify-syntax-entry 43 "." table) (modify-syntax-entry 45 "." table) (modify-syntax-entry 61 "." table) (modify-syntax-entry 37 "." table) (modify-syntax-entry 60 "." table) (modify-syntax-entry 62 "." table) (modify-syntax-entry 39 "\"" table) (setq m2-mode-syntax-table table)))
(defvar m2-mode-map nil "\
Keymap used in Modula-2 mode.")
(if m2-mode-map nil (let ((map (make-sparse-keymap))) (define-key map " " (quote m2-tab)) (define-key map "b" (quote m2-begin)) (define-key map "c" (quote m2-case)) (define-key map "d" (quote m2-definition)) (define-key map "e" (quote m2-else)) (define-key map "f" (quote m2-for)) (define-key map "h" (quote m2-header)) (define-key map "i" (quote m2-if)) (define-key map "m" (quote m2-module)) (define-key map "l" (quote m2-loop)) (define-key map "o" (quote m2-or)) (define-key map "p" (quote m2-procedure)) (define-key map "" (quote m2-with)) (define-key map "r" (quote m2-record)) (define-key map "s" (quote m2-stdio)) (define-key map "t" (quote m2-type)) (define-key map "u" (quote m2-until)) (define-key map "v" (quote m2-var)) (define-key map "w" (quote m2-while)) (define-key map "x" (quote m2-export)) (define-key map "y" (quote m2-import)) (define-key map "{" (quote m2-begin-comment)) (define-key map "}" (quote m2-end-comment)) (define-key map "" (quote suspend-emacs)) (define-key map "" (quote m2-visit)) (define-key map "" (quote m2-toggle)) (define-key map "" (quote m2-link)) (define-key map "" (quote m2-compile)) (setq m2-mode-map map)))
(defvar m2-indent 5 "\
*This variable gives the indentation in Modula-2-Mode")
(defun modula-2-mode nil "\
This is a mode intended to support program development in Modula-2.
All control constructs of Modula-2 can be reached by typing
Control-C followed by the first character of the construct.
\\{m2-mode-map}
Control-c b begin Control-c c case
Control-c d definition Control-c e else
Control-c f for Control-c h header
Control-c i if Control-c m module
Control-c l loop Control-c o or
Control-c p procedure Control-c Control-w with
Control-c r record Control-c s stdio
Control-c t type Control-c u until
Control-c v var Control-c w while
Control-c x export Control-c y import
Control-c { begin-comment Control-c } end-comment
Control-c Control-z suspend-emacs Control-c Control-t toggle
Control-c Control-c compile Control-x ` next-error
Control-c Control-l link
m2-indent controls the number of spaces for each indentation.
m2-compile-command holds the command to compile a Modula-2 program.
m2-link-command holds the command to link a Modula-2 program." (interactive) (byte-code "±È¼ Ƚ!ȾÉÈàÉÈáˆ!ÈâÉÈá˜!ÈãÉÈä!Èá˘!ÈåPÉÈá¨!ÈÉÈá²!È˚É Èá¸!È˚ÉÈá³!ÈçÉÈá˝!ÈèÉÈáˆ!ÈâÉÈá˛!ÈéÉÈáˇ!ÈêÉÈá—!È˚ÉÈëì!Ç" [m2-mode-map major-mode mode-name comment-column end-comment-column m2-mode-syntax-table paragraph-start page-delimiter paragraph-separate paragraph-ignore-fill-prefix t require-final-newline comment-start comment-end comment-start-skip comment-indent-hook parse-sexp-ignore-comments nil kill-all-local-variables use-local-map modula-2-mode "Modula-2" make-local-variable 41 75 set-syntax-table "^$\\|" "(* " " *)" "/\\*+ *" c-comment-indent run-hooks m2-mode-hook] 17))
(defun m2-newline nil "\
Insert a newline and indent following line like previous line." (interactive) (byte-code "ˋÈ´ ˆ Èj)Ç" [hpos nil current-indentation newline] 3))
(defun m2-tab nil "\
Indent to next tab stop." (interactive) (byte-code "ˋÈ´ˆ˜ \"T\"jÇ" [m2-indent nil * / current-indentation] 5))
(defun m2-begin nil "\
Insert a BEGIN keyword and indent for the next line." (interactive) (byte-code "¹ÈˋcÈ´ Ȉ Ç" [nil "BEGIN" m2-newline m2-tab] 3))
(defun m2-case nil "\
Build skeleton CASE statment, prompting for the <expression>." (interactive) (byte-code "¹Èˋ´ˆ˜!¯#È˘ È˘ È˙cȨ²!È˚ Ç" [nil insert "CASE " read-string ": " " OF" m2-newline "END (* case *);" end-of-line 0 m2-tab] 7))
(defun m2-definition nil "\
Build skeleton DEFINITION MODULE, prompting for the <module name>." (interactive) (byte-code "ˋÈ´cȈ˜!¯˘˙$)Ȩ²!Ç" [name nil "DEFINITION MODULE " read-string "Name: " insert ";
END " ".
" previous-line 3] 6))
(defun m2-else nil "\
Insert ELSE keyword and indent for next line." (interactive) (byte-code "ˋÈ´ Ȉˋ\"ȘcÈ´ ȯ Ç" [m2-indent nil m2-newline backward-delete-char-untabify "ELSE" m2-tab] 5))
(defun m2-for nil "\
Build skeleton FOR loop statment, prompting for the loop parameters." (interactive) (byte-code "ˋÈ´ˆ˜¯!˘˜˙!$Ș¨!²˚\"?Ä´¸\")ȳcÈ˝ È˝ È˛cÈˇ—!ȱ Ç" [by nil insert "FOR " read-string "init: " " TO " "end: " "by: " string-equal "" " BY " " DO" m2-newline "END (* for *);" end-of-line 0 m2-tab] 11))
(defun m2-header nil "\
Insert a comment block containing the module title, author, etc." (interactive) (byte-code "¹ÈˋcÈ´ˆ!cȘcȯ cÈ˘cÈ˙ cȨ²˚ ¸³ ˝%cÈ˛cÇ" [nil "(*
Title: " read-string "Title: " "
Created: " current-time-string "
Author: " user-full-name concat "
<" user-login-name "@" system-name ">
" "*)
"] 11))
(defun m2-if nil "\
Insert skeleton IF statment, prompting for <boolean-expression>." (interactive) (byte-code "¹Èˋ´ˆ˜!¯#È˘ È˘ È˙cȨ²!È˚ Ç" [nil insert "IF " read-string "<boolean-expression>: " " THEN" m2-newline "END (* if *);" end-of-line 0 m2-tab] 7))
(defun m2-loop nil "\
Build skeleton LOOP (with END)." (interactive) (byte-code "¹ÈˋcÈ´ È´ ȈcȘ¯!È˘ Ç" [nil "LOOP" m2-newline "END (* loop *);" end-of-line 0 m2-tab] 5))
(defun m2-module nil "\
Build skeleton IMPLEMENTATION MODULE, prompting for <module-name>." (interactive) (byte-code "ˋÈ´cȈ˜!¯˘˙$)Ȩ²!Ç" [name nil "IMPLEMENTATION MODULE " read-string "Name: " insert ";
END " ".
" previous-line 3] 6))
(defun m2-or nil (interactive) (byte-code "ˋÈ´ Ȉ!ȘcÈ´ ȯ Ç" [m2-indent nil m2-newline backward-delete-char-untabify "|" m2-tab] 5))
(defun m2-procedure nil (interactive) (byte-code "´ÈˆcȘ¯!´˘˙\"È˘˜¨!²\"Ș˚!Éȸ ³\"?Ä)˘˝ \"È˛cÈˇ È—cÈˇ Èˇ ȱcÈcÈ˛cȼ½!Ⱦ *Ç" [name args nil "PROCEDURE " read-string "Name: " insert " (" "Arguments: " ")" "Result Type: " string-equal "" " : " ";" m2-newline "BEGIN" "END " end-of-line 0 m2-tab] 13))
(defun m2-with nil (interactive) (byte-code "¹ÈˋcÈ´ˆ!cȘcȯ ȯ È˘cÈ˙¨!Ȳ Ç" [nil "WITH " read-string ": " " DO" m2-newline "END (* with *);" end-of-line 0 m2-tab] 6))
(defun m2-record nil (interactive) (byte-code "¹ÈˋcÈ´ È´ ȈcȘ¯!È˘ Ç" [nil "RECORD" m2-newline "END (* record *);" end-of-line 0 m2-tab] 5))
(defun m2-stdio nil (interactive) (byte-code "¹ÈˋcÇ" [nil "
>FROM TextIO IMPORT
WriteCHAR, ReadCHAR, WriteINTEGER, ReadINTEGER,
WriteCARDINAL, ReadCARDINAL, WriteBOOLEAN, ReadBOOLEAN,
WriteREAL, ReadREAL, WriteBITSET, ReadBITSET,
WriteBasedCARDINAL, ReadBasedCARDINAL, WriteChars, ReadChars,
WriteString, ReadString, WhiteSpace, EndOfLine;
>FROM SysStreams IMPORT sysIn, sysOut, sysErr;
"] 1))
(defun m2-type nil (interactive) (byte-code "¹ÈˋcÈ´ Ȉ Ç" [nil "TYPE" m2-newline m2-tab] 3))
(defun m2-until nil (interactive) (byte-code "¹ÈˋcÈ´ È´ ȈcȘ¯˘!˙\"Ȩ²!È˚ Ç" [nil "REPEAT" m2-newline "UNTIL " insert read-string ": " ";" end-of-line 0 m2-tab] 7))
(defun m2-var nil (interactive) (byte-code "¹Èˋ È´cÈˋ Ȉ Ç" [nil m2-newline "VAR" m2-tab] 4))
(defun m2-while nil (interactive) (byte-code "¹ÈˋcÈ´ˆ!cȘcȯ ȯ È˘cÈ˙¨!Ȳ Ç" [nil "WHILE " read-string ": " " DO" m2-newline "END (* while *);" end-of-line 0 m2-tab] 6))
(defun m2-export nil (interactive) (byte-code "¹ÈˋcÇ" [nil "EXPORT QUALIFIED "] 1))
(defun m2-import nil (interactive) (byte-code "¹ÈˋcÈ´ˆ!cȘcÇ" [nil "FROM " read-string "Module: " " IMPORT "] 2))
(defun m2-begin-comment nil (interactive) (byte-code "ˋÈn?Ä´ˆ\"ȘcÇ" [comment-column nil indent-to 0 "(* "] 3))
(defun m2-end-comment nil (interactive) (byte-code "ˋÈn?Ä jÈ´cÇ" [end-comment-column nil "*)"] 1))
(defun m2-compile nil (interactive) (byte-code "´Èˆ ÉȘ ¯Q!Ç" [modulename m2-compile-command nil buffer-name compile " "] 5))
(defun m2-link nil (interactive) (byte-code "ˆÈ˜ ÉÈ Â¯
˘ Q!Á¯
˘˙¨\"ÉQ!Ç" [modulename m2-link-name m2-link-command nil buffer-name compile " " read-string "Name of executable: "] 8))
(defun execute-monitor-command (command) (byte-code " ˘˙!¨\"²ˆ˜˜˚¸P&*Ç" [shell shell-file-name csh nil t command equal file-name-nondirectory "csh" call-process "-cf" "exec "] 10))
(defun m2-visit nil (interactive) (byte-code "ˋÈˋˋˋʘ¯!ÉÈ˘˙!Ȩ²P!ÈebÈˋ˚¸ÏÈˋ³˝ÏÈÅ+
?Ä3˛ˇ\")ÈÂI—!È
ÄFÊ—
!)ÁP
ÄP—
!+Ç" [deffile nil modfile modulename read-string "Module name: " switch-to-buffer "*Command Execution*" execute-monitor-command "m2whereis " (byte-code "ˋ´!Ȉ˜¯!˘¯!\"ÉÇ" [deffile re-search-forward "\\(.*\\.def\\) *$" buffer-substring match-beginning 1 match-end] 6) ((search-failed (byte-code "¹Ç" [nil] 1))) (byte-code "ˋ´!Ȉ˜¯!˘¯!\"ÉÇ" [modfile re-search-forward "\\(.*\\.mod\\) *$" buffer-substring match-beginning 1 match-end] 6) ((search-failed (byte-code "¹Ç" [nil] 1))) error "I can find neither definition nor implementation of %s" find-file] 8))
(defun m2-toggle nil "\
Toggle between .mod and .def files for the module." (interactive) (byte-code "¹Èˋ´ ˆ¹O˜\"¯´ ˘ˆO˙P!Á[ˋ´ ˆ¹O˙\"Â0¯´ ˘ˆO˜P!Á[ˋ´ ¨¹O²\"ÂG¯´ ˘¨O˚P!Á[ˋ´ ¨¹O˚\"Ä[¯´ ˘¨O²P!Ç" [nil string-equal buffer-name -4 ".def" find-file-other-window 0 ".mod" -3 ".mi" ".md"] 19))